<?xml version="1.0" encoding="UTF-8"?>
<Module>
<ModulePrefs title="Test Vocabulaire Anglais" scaling="false" description="Test Vocabulaire Anglais" author="Olivier BEZES" author_email="khnoumhotep@gmail.com"/>
<Content type="html"><![CDATA[
		<style type="text/css">
			<!--
				* { background-color:#F9F9F9;}
				#masque { z-index:2;visibility:hidden;position:fixed;width:100%;cursor:wait;}
				#masque.ok { visibility:visible;background-color:green;}
			-->
		</style>
		<style type="text/css">
			<!--
				#masque.nok { visibility:visible;background-color:red;}
			-->
		</style>
		<script type="text/javascript">
			function beanFichesVocabulaire( _title, _object, _nbWord) {
				this.title	= _title;
				this.object	= _object;
				this.nbWord	= _nbWord;
			};
			var fichesVocabulaire = [];
			function beanTraduction( _fw, _ew1, _ew2, _ew3, _ew4, _ew5, _ew6, _ew7) {
				this.word	= new Array(8);
				this.word[0]	= _fw;
				this.word[1]	= _ew1;
				this.word[2]	= _ew2;
				this.word[3]	= _ew3;
				this.word[4]	= _ew4;
				this.word[5]	= _ew5;
				this.word[6]	= _ew6;
				this.word[7]	= _ew7;
			};
		</script>
		<script type="text/javascript" src="http://obezes.free.fr/Gadgets/cielTerre.js"></script>
		<script type="text/javascript" src="http://obezes.free.fr/Gadgets/commerce.js"></script>
		<script type="text/javascript" src="http://obezes.free.fr/Gadgets/corpshumain.js"></script>
		<script type="text/javascript" src="http://obezes.free.fr/Gadgets/ferme.js"></script>
		<script type="text/javascript" src="http://obezes.free.fr/Gadgets/insectesoiseaux.js"></script>
		<script type="text/javascript" src="http://obezes.free.fr/Gadgets/jardins.js"></script>
		<script type="text/javascript" src="http://obezes.free.fr/Gadgets/mer.js"></script>
		<script type="text/javascript" src="http://obezes.free.fr/Gadgets/metiers.js"></script>
		<script type="text/javascript" src="http://obezes.free.fr/Gadgets/passetemps.js"></script>
		<script type="text/javascript" src="http://obezes.free.fr/Gadgets/religion.js"></script>
		<script type="text/javascript" src="http://obezes.free.fr/Gadgets/sports.js"></script>
		<script type="text/javascript" src="http://obezes.free.fr/Gadgets/tempsquipasse.js"></script>
		<script type="text/javascript" src="http://obezes.free.fr/Gadgets/tempssaisons.js"></script>
		<script type="text/javascript" src="http://obezes.free.fr/Gadgets/vetements.js"></script>
		<script type="text/javascript" src="http://obezes.free.fr/Gadgets/vieurbaine.js"></script>
		<script type="text/javascript" src="http://obezes.free.fr/Gadgets/voiture.js"></script>
		<script type="text/javascript" src="http://obezes.googlepages.com/verbesirreguliers.js"></script>
		<script type="text/javascript">
			var kc13 = true;
			var fiche = null;
			var indiceobject = 0;
			window.onload = init;
			function init() {
				document.getElementById( "tib1").disabled = true;
				document.getElementById( "tib2").disabled = true;
				fichesManagement();
			};
			function fichesManagement() {
				var fs = document.getElementById( "fs");
				var option = document.createElement("option");
				for( var i = 0; i < fichesVocabulaire.length; i++) {
					option = document.createElement("option");
					option.appendChild( document.createTextNode( (i+1) + ". " + fichesVocabulaire[i].title));
					option.value = i;
					fs.appendChild( option);
				}
			}
			function fco( s) {
				document.getElementById( "tib1").disabled = true;
				document.getElementById( "tib2").disabled = true;
				var v = s.options[s.selectedIndex].value;
				if ( v == -1) return;
				fiche = fichesVocabulaire[v];
				ficheManagement();
				randomtf();
				document.getElementById( "tib1").disabled = false;
				document.getElementById( "tib2").disabled = false;
			}
			function ficheManagement() {
				erasetf();
				var tf = document.getElementById( "tf");
				var tds = document.getElementById( "tds");
				if ( fiche.nbWord > (tf.elements.length - 2)) {
					for ( var i = (tf.elements.length - 2); i < fiche.nbWord; i++) {
						var div = document.createElement("div");
						div.id = 'td' + i;
						var input = document.createElement("input");
						input.type = 'text',
						input.id = 'ti' + i;
						input.name = 'ti' + i;
						input.style.width = '100%';
						div.appendChild( input);
						tds.appendChild( div);
					}
					return;
				} else if ( fiche.nbWord < (tf.elements.length - 2)) {
					var ld	= tds.getElementsByTagName("div");
					for ( var i = (fiche.nbWord - 1); i < ld.length; i++)
						tds.removeChild( ld[i]);
				}
			}
			function io() {
				if ( fiche == null) return;
				indiceobject = Math.floor( Math.random() * fiche.object.length);
			}
			function randomtf() {
				if ( fiche == null) return;
				document.getElementById( "tib1").disabled = false;
				erasetf();
				var tf = document.getElementById( "tf");
				var i1 = Math.floor( Math.random() * fiche.nbWord);
				io();
				tf.elements[i1].value = fiche.object[indiceobject].word[i1];
			}
			function erasetf() {
				var tf = document.getElementById( "tf");
				for ( i = 0; i < tf.elements.length; i++) {
					if ( tf.elements[i].type == 'button')
						continue;
					tf.elements[i].value = "";
				}
			}
			function veriftf() {
				if ( fiche == null) return;
				document.getElementById( "tib1").disabled = true;
				var tf = document.getElementById( "tf");
				var b = 0;
				for ( i = 0; i < tf.elements.length && b == 0; i++) {
					if ( tf.elements[i].type == 'button')	continue;
					b = b + ( tf.elements[i].value.length == fiche.object[indiceobject].word[i].length) ? 0 : -1;
					b = b + tf.elements[i].value.indexOf( fiche.object[indiceobject].word[i]);
				}
				if ( b == 0) {
					masquemanagement( 'ok');
				} else {
					masquemanagement( 'nok');
					for ( i = 0; i < tf.elements.length; i++) {
						if ( tf.elements[i].type == 'button')	continue;
						tf.elements[i].value = fiche.object[indiceobject].word[i];
					}
				}
				setTimeout(function(){ masquemanagement( '')}, 250);
			}
			function masquemanagement( type) {			
				h = hauteur_fenetre();
				var t = document.getElementById( "t");
				var masque = document.getElementById( "masque");
				t.style.display = 'none';
				masque.className = type;
				masque.style.height = h + 'px';
				if ( type == '') {
					t.style.display = 'block';
					masque.style.height = '0px';
				}
			}
			function hauteur_fenetre() {
 				if (window.innerHeight) return window.innerHeight  ;
 				else if (document.body && document.body.offsetHeight) return document.body.offsetHeight;
 				else return 0;
			}
			function keyupmanagement( kc) {
				if ( kc != 13)
					return;
				if ( kc13 == true) {
					kc13 = false;
					veriftf();
				}
			}
		</script>
		<div id="t" style="width:100%" onkeyup="keyupmanagement( event.keyCode);">
			<div style="float:left;width:5%;">&nbsp;</div>
			<div style="float:left;width:90%;padding:2px;margin:2px">
				<div id="fiches">
					<table width="100%">
						<tbody>
							<tr>
								<td style="width:10%">&nbsp;</td>
								<td style="width:80%">
									<form name="ff" id="ff" action="">
										<div>
											<select name="fs" id="fs" style="vertical-align: middle; width:100%;" onchange="fco( this);">
												<option SELECTED value="-1">Choisir un theme
											</select>
										</div>
									</form>
								</td>
								<td style="width:10%">
									<h1 id="t2h1">&nbsp;</h1>
								</td>
							</tr>
						</tbody>
					</table>
				</div>
				<div id="traduct" style="clear:left">
					<form name="tf" id="tf" action="" >
						<div id="tds" >
							<div id="td0"><input type="text" style="width:100%" name="ti"></div>
							<div id="td1"><input type="text" style="width:100%" name="ti1"></div>
						</div>
						<div style="clear:left">
							<div>&nbsp;</div>
							<div style="border: 1px dashed black;border-width: 0px 0px 1px 0px;"></div>
							<div>&nbsp;</div>
							<div style="float:left"><input type="button" name="tib1" id="tib1" value="Verifier" onclick="javascript:veriftf();kc13=false;"/></div>
							<div style="float:right"><input type="button" name="tib2" id="tib2" value="Nouveau mot" onclick="javascript:randomtf();kc13=true;"/></div>
						</div>
					</form>
				</div>
			</div>
			<div style="float:right;width:5%">&nbsp;</div>
		</div>
		<div id="masque"></div>
]]></Content>
</Module>